package com.ctl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ctl.entity.Following;
import com.ctl.service.FollowingService;
import com.ctl.mapper.FollowingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author stars
* @description 针对表【following(关注)】的数据库操作Service实现
* @createDate 2023-02-27 16:18:41
*/
@Service
public class FollowingServiceImpl extends ServiceImpl<FollowingMapper, Following>
    implements FollowingService{
    @Autowired
    private FollowingMapper mapper;
    //判断用户是否相互关注
    public Boolean isFollowing(Integer uid,Integer followId){
        QueryWrapper<Following> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("uid",uid)
                .eq("following_id",followId);
        Following following = mapper.selectOne(queryWrapper);
        if (following==null){
            return false;
        }else {
            return true;
        }

    }

}




